/*
 * Copyright (c) 2025 EasyAdmin
 * All rights reserved.
 *
 * This file is part of the [EasAdmin] project.
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 * Proprietary and confidential.
 *
 * Author: EasyAdmin ( 1073602@qq.com )
 * Website: https://www.xhxiao.com
 */
package com.easy.module.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.easy.framework.common.validate.Add;
import com.easy.framework.common.validate.Update;
import com.easy.framework.database.entity.DefaultEntity;
import com.easy.framework.poi.annotation.Excel;
import com.easy.framework.poi.annotation.Option;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 应用菜单 实体
 *
 * @author EasyAdmin ( 1073602@qq.com )
 * @date 2025-08-20
 */
@Getter
@Setter
@TableName("sys_app_menu")
public class SysAppMenu extends DefaultEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 编号
     */
    @Excel(name = "编号")
    @TableId(type = IdType.AUTO)
    private Long id;


    /**
     * 上级编号
     */
    @Excel(name = "上级编号")
    private Long parentId;


    /**
     * 名称
     */
    @Excel(name = "名称")
    @Size(message = "名称长度必须小于64个字", max = 64, groups = {Add.class, Update.class})
    private String name;


    /**
     * 图标
     */
    @Excel(name = "图标")
    @Size(message = "图标长度必须小于255个字", max = 255, groups = {Add.class, Update.class})
    private String icon;


    /**
     * 组件路由
     */
    @Excel(name = "组件路由")
    @Size(message = "组件路由长度必须小于128个字", max = 128, groups = {Add.class, Update.class})
    private String component;


    /**
     * 参数
     */
    @Excel(name = "参数")
    @Size(message = "参数长度必须小于255个字", max = 255, groups = {Add.class, Update.class})
    private String query;


    /**
     * 序号
     */
    @Excel(name = "序号")
    private Integer sort;


    /**
     * 授权类型（0公开，1角色授权
     */
    @Excel(
            name = "授权类型",
            options = {
                    @Option(value = "0", name = "公开"),
                    @Option(value = "1", name = "角色授权")
            }
    )
    private Integer authType;


    /**
     * 包名
     */
    @Excel(name = "包名")
    @Size(message = "包名长度必须小于64个字", max = 64, groups = {Add.class, Update.class})
    private String packageName;


    /**
     * 状态（0正常 1停用）
     */
    @Excel(
            name = "状态",
            options = {
                    @Option(value = "0", name = "正常"),
                    @Option(value = "1", name = "停用")
            }
    )
    @NotNull(message = "状态不能为空", groups = {Add.class, Update.class})
    private Integer status;



    /**
     * 创建人名称
     */
    @TableField(exist = false)
    private String createdByDesc;

    /**
     * 更新人名称
     */
    @TableField(exist = false)
    private String updatedByDesc;



    /**
     * 子菜单
     */
    @TableField(exist = false)
    private List<SysAppMenu> children;
}